home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 21 / CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso / CUCD / Online / AutoPage / httpj.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1998-02-01  |  3.1 KB  |  8 lines

  1. /* $VER: httpj.rexx v0.6, 01 Feb 1998
  2. ** Co script for AutoPage.rexx 
  3. ** © Arne Seime <aseime@iname.com> 1998
  4. ** Please check out documentation or the autopage.ibrx script.
  5. ** Don't edit anything below. Thank you.
  6. */
  7. parse arg id;options results;options failat 21;call addlib('rexxsupport.library',0,-30);savedir = getclip(ap_savedir);progdir = getclip(ap_progdir);buffers = getclip(ap_buffers);if ~show(p,"HTTPJ." || id) then;do;call openport("HTTPJ." || id);say "PORT HTTPJ." || id "succsessfully opened";end;cmd = open;do until cmd = CLOSE;call waitpkt("HTTPJ." || id);call waitpkt("HTTPJ." || id);call setclip("HTTPJ." || id,1);packet = getpkt("HTTPJ." || id);if packet ~= null() then;cmd = getarg(packet);parse value cmd with line url image show;call reply(packet,0);if line = '' then break;if line = CLOSE then break;if image = 0 then images = 'nofiles';if image = 1 then images = '';ok = open(output,"T:autopage_temp." || line,w);address command progdir || 'httpj >T:_httpj_temp.' || line url 'Update Buffer' buffers 'Mirror' savedir images;rcc = rc;if show = ~0 then;do;if rcc = 0 then ;do;rcc = Explanation2Code();call close(logfile);end;state = Code2Explanation(rcc);durl = url;ourl = url;if lastpos('~',durl) ~= 0 then;do until lastpos('~',durl) = 0;durl = overlay('!',durl,lastpos('~',durl));end;if rcc = 0 | rcc = 2 then ;do;fdate = date();ftime = time();end;else;do;ftime_fdate = GetOldFileInfo(savedir,durl);fdate = left(ftime_fdate,11);ftime = word(ftime_fdate,4);end;url = ourl;call writeln(output,'<TR>' || state || '<TD><A HREF="' || durl || '">' || url || '</A></TD><TD>' || fdate || '</TD><TD>' || ftime || '</TD></TR>');call close(output);end;call setclip("HTTPJ." || id,0);end;call closeport("HTTPJ." || id);say "PORT HTTPJ." || id "sucsessfully closed";exit;Code2Explanation:;parse arg code;if code = 1 then return '<TD BGCOLOR='WHITE'>OLD</TD>';if code = 0 then return '<TD BGCOLOR='#ffff50'>NEW</TD>';if code = 2 then return '<TD BGCOLOR='PURPLE'>MOVED</TD>';if code = 11 then return '<TD BGCOLOR='#ff8080'>ERROR</TD>';if code = 17 then return '<TD BGCOLOR='#ff8080'>NO TCP/IP</TD>';if code = 20 then return '<TD BGCOLOR='#ff8080'>NO TCP/IP</TD>';if code = 404 then return '<TD BGCOLOR='#ff8080'>NOT FOUND</TD>';else return '<TD BGCOLOR='#ff8080'>UNKNOWN</TD>';exit;Explanation2Code:;if open(logfile,'T:_httpj_temp.' || line,R) then;do while ~eof(logfile);do x=1 to 4;data = readln(logfile);end;data = readln(logfile);if right(data,3) = 'OLD' then return 1;if right(data,7) = 'ERR 404' then return 404;if right(data,10) = 'MOVED...OK' then return 2;if right(data,2) = 'OK' then return 0;if left(data,6) = 'Mirror' then break;else return 11;end;Say 'ERROR: Unable to open httpj redirection file. (T:_httpj_temp.x)';Exit;GetOldFileInfo:;parse arg savedir,url;if ~exists(savedir || url) then return 'NOT FOUND';oldfileinfo = statef(savedir || durl);parse value oldfileinfo with . . . . odate otime .;fdate = date(n,odate,i);last = lastpos('.',(otime/60));if last ~=0 then;do;hours = left((otime/60),last-1);minutes = otime - (60*hours);if minutes <10 then minutes = '0' || minutes;end;else;do;hours = otime/60;minutes = '00';end;ftime = hours || ':' || minutes || ':00';return fdate ftime;
  8.